package svc

import (
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"poblish_house/api/internal/config"
	"poblish_house/api/internal/middleware"
	"poblish_house/house_srv/houseclient"
)

type ServiceContext struct {
	Config    config.Config
	AuthToken rest.Middleware
	HouseSrv  houseclient.House
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:    c,
		AuthToken: middleware.NewAuthTokenMiddleware().Handle,
		HouseSrv:  houseclient.NewHouse(zrpc.MustNewClient(c.HouseSrv)),
	}
}
